package com.foreknow.demo11;

public class Student {
    private String name; //成员变量，属性某个对象的属性
    public static int count; //静态属性 属于整个类

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static void eat() {
        System.out.println("eat......");
    }

    public static void main(String[] args) {
        Student s1 = new Student();
        s1.setName("fender");
        Student.count = 1; //可以通过类名.属性名来访问静态属性
        Student.eat();//可以通过类名.方法名()来访问静态方法，如果是在同一个类中调用，可以省略类名

        Student s2 = new Student();
        s2.setName("gibson");
        Student.count = 100;
        Student.eat();

        System.out.println(s1.getName());
        System.out.println(s1.count);
        System.out.println("----------------------------------");
        System.out.println(s2.getName());
        System.out.println(s2.count);
    }
}
